Systems and methods for generating a forecasting model and forecasting future values

ABSTRACT

Systems and methods are provided for generating a forecasting model based on a set of measured values. Consistent with certain embodiments, the forecasting model may include a seasonal function and a trend function. Further, consistent with other embodiments, the computer-implemented systems and methods may include computing the forecasting model by minimizing an error function representing the error between the forecasting model and the measured values. In addition, consistent with yet other embodiments, the computer-implemented systems and methods may include a process for outlier detection and removal based on a computation of residuals. Still further, consistent with some embodiments, systems and methods may be provided to filter the seasonality and/or the trend components to eliminate sudden variations in the model predictions resulting from sudden, large variations in the measurement values.

TECHNICAL FIELD

The present disclosure relates generally to the field of data processing and computer-implemented systems and methods for forecasting future values. More specifically, and without limitation, the present disclosure relates to forecasting a future value based on a set of measured values obtained over a period of time, as well as predicting a future value using a forecasting model.

BACKGROUND

Forecasting a future value typically involves deriving a mathematical model from a set of measurements taken over a period of time and using the model to forecast future values. Such forecasts are particularly useful in business, for example, to ensure that the demand for goods can be met by the existing inventory of goods or the likely volume of produced goods. A sales organization of a business may use inventory forecasts to ensure that sufficient inventory exists to meet future orders. As a further example, a delivery organization of a business may use inventory and/or other forecasts to schedule delivery of existing orders.

Over the years, techniques have been proposed to generate forecasting models based on a fixed polynomial or Fourier series variation of values over time. In most cases, model parameters are generated by minimizing the residual sum of squares based on the assumed fixed polynomial or Fourier series variation. Such models, however, fail to provide accurate forecasts of future values when the underlying measurements either have seasonal variations or when the data set containing the measurements includes extreme outliers, non stationary noise, or discontinuities.

In view of the above drawbacks, there is a need for improved systems and methods for forecasting future values, including systems and methods for generating forecasting models that can account for both seasonal variations and extreme outliers. There is also a need for improved systems and methods for generating such forecasting models by simultaneously including the most recent actual measurements or data and minimizing the computation cost of generating model parameters. In addition, there is a need for improved techniques for identifying and removing outliers from the measurements to generate a more accurate forecasting model.

SUMMARY

In accordance with the present disclosure, computer-implemented systems and methods are provided for forecasting future values. Embodiments of the present disclosure encompass systems and methods for generating a forecasting model that can account for both seasonal variations and extreme outliers. Embodiments of the present disclosure also encompass systems and methods for identifying and removing outliers in the measured values to improve the accuracy of the forecasting model. In addition, embodiments of the present disclosure encompass systems and methods for filtering the seasonal and trend components to reduce the impact of sudden changes in the measured values used to generate the forecasting model parameters.

In accordance with an exemplary embodiment, a computer-implemented method is provided for forecasting a future value. By way of example, the method comprises generating a forecasting model comprising a seasonal function representing a seasonal variation and a trend function representing a trend; minimizing a cost function including an error between a first set of values and model estimations corresponding to the first set of values computed using the forecasting model; computing, with at least one processor, model parameters comprising seasonality parameters and trend coefficients; and forecasting, with the at least one processor, the future value using the computed model parameters. In certain exemplary embodiments, the seasonal function may comprise a truncated Fourier series and the trend function may comprise a spline function. In other exemplary embodiments, the spline function may be a cubic spline function.

In accordance with another exemplary embodiment, a computer-implemented method is provided for detecting and removing an outlier. By way of example, the method comprises computing predicted values corresponding to the first set of values using the model parameters; computing residuals between the first set of values and the estimated values; computing a standard deviation of the residuals; and identifying, as an outlier, a value from the first set of values for which a residual exceeds a predetermined multiple of the standard deviation.

In accordance with still other exemplary embodiments, a method for outlier detection and removal may comprise removing a detected outlier from a first set of values to generate a second set of values; and computing model parameters based on the second set of values.

In accordance with another exemplary embodiment, a computer-implemented method is provided for forecasting a future value. By way of example, the method includes computing a seasonal component of the future value based on adjusted seasonal parameters, computing a trend component of the future value, and combining the seasonal component and the trend component to obtain the future value. In accordance with certain exemplary embodiments, the method includes computing seasonal parameters, computing a maximum permissible seasonal parameter value from the computed seasonal parameters, accessing a historical maximum permissible seasonal parameter value, adjusting the maximum permissible seasonal parameter value using a first weighting function based on the historical maximum permissible seasonal parameter value, and adjusting the seasonal parameters using a second weighting function based on the adjusted maximum permissible seasonal parameter value.

In accordance with another exemplary embodiment, a computer-implemented system is provided for forecasting a future value. By way of example, the system includes a database for storing a first set of values and a second set of values; a forecasting model generator for performing a model generation method; and a forecaster for performing a forecasting method. The model generation method of the forecasting model generator may include generating a forecasting model comprising a seasonal function representing a seasonal variation and a trend function representing a trend, minimizing a cost function including an error between the first set of values and model estimations corresponding to the first set of values computed using the forecasting model, computing model parameters comprising seasonality parameters and trend coefficients, and storing the model parameters in the database. The forecasting method of the forecaster may include accessing the model parameters from the database; and forecasting the future value using the model parameters.

In accordance with another exemplary embodiment, a computer program product is provided. By way of example, the computer program product includes executable instructions tangibly embodied in a non-transitory computer-readable medium for performing a method of forecasting a future value. The method may include generating a forecasting model comprising a seasonal function representing a seasonal variation and a trend function representing a trend, minimizing a cost function including an error between a first set of values and model estimations corresponding to the first set of values computed using the forecasting model, computing model parameters comprising seasonality parameters and trend coefficients, and forecasting the future value using the computed model parameters.

Additional objects and advantages will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the embodiments of the present disclosure. The above and other objects and advantages will be realized and attained by means of the elements and combinations particularly pointed out in the appended claims.

It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only, and are not restrictive of the embodiments of the invention, as claimed.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain one or more principles. In the drawings:

FIG. 1 shows an exemplary electronic communications system for implementing embodiments of the present disclosure;

FIG. 2 shows an exemplary method of generating a forecasting model, consistent with an embodiment of the present disclosure;

FIG. 3 shows an exemplary set of B-spline basis functions associated with a knot sequence of 16 variable distance knots in the interval 0 to 15, consistent with an embodiment of the present disclosure;

FIG. 4 shows an exemplary set of B-spline basis functions associated with a knot sequence of 16 equally spaced knots in the interval 0 to 15, consistent with an embodiment of the present disclosure;

FIG. 5 shows an exemplary method of detecting and removing an outlier from the set of measured values, consistent with an embodiment of the present disclosure;

FIG. 6 shows the effect of removing outliers on the forecasting model consistent with an embodiment of the present disclosure;

FIG. 7 shows the effect of removing outliers on the residuals, consistent with an embodiment of the present disclosure;

FIG. 8 shows an exemplary method of post filtering the values computed using the forecasting model, consistent with an embodiment of the present disclosure; and

FIG. 9 shows an exemplary method of forecasting values for any desired time horizon using the forecasting model, consistent with an embodiment of the present disclosure.

DETAILED DESCRIPTION OF THE EMBODIMENTS

Reference will now be made in detail to the present exemplary embodiments of the present disclosure, examples of which are illustrated in the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings to refer to the same or like parts.

FIG. 1 shows a block diagram of an exemplary electronic communications system 100 for implementing embodiments of the present disclosure or aspects thereof. System 100 may include one or more data collection stations, for example, data stations 102 (e.g., Data Station 1, Data Station 2, . . . Data Station N). Data stations 102 may be implemented with devices and/or applications running thereon. By way of example, data stations 102 may include personal computers, laptop computers, tablet computers, personal digital assistants, mobile telephones, point of sale terminals, inventory control terminals, and/or other types of electronic data entry or communication devices. Each data station 102 may include a processor 112, a memory 114 for storing data, and/or other storage devices (not shown), such as hard drives, NOR or NAND flash memory devices, or Read Only Memory (ROM) devices, etc. In certain embodiments, memory 114 may comprise a non-transitory computer-readable medium.

In addition, consistent with some embodiments, data stations 102 may be configured to communicate to and/or through a communications medium 104. In certain embodiments, the communications medium 104 may include any combination of communications networks. For example, the communications medium 104 may include the Internet and/or another type of wide area network, an Intranet, a metropolitan area network, a local area network, a wireless network, a cellular communications network, etc.

In some embodiments, data stations 102 may be configured to receive data, including sales data, inventory data, accounts receivable data, accounts payable data, and/or any other type of measured values or data for determining a forecasted value. Data stations 102 may receive such data from the communications medium 104. Data stations 102 may also receive such data from a variety of input sources, for example, hard drives, recordable media, memory cards, etc. In addition, data stations 102 may receive data through a keyboard or other data entry devices. Data stations 102 may transmit such data through the communications medium 104 to appropriate storage devices or databases, for example, database 110.

The database 110 may include one or more logically and/or physically separate databases configured to store data and/or other parameters. In some embodiments, database 110 may be implemented using a non-transitory computer-readable storage medium. In other embodiments, database 110 may be maintained in a network-attached storage device, in a storage area network, or combinations thereof, etc. Furthermore, database 110 may be maintained and queried using numerous types of database software and programming languages, such as SQL, MySQL, IBM DB2®, Microsoft Access®, PERL, C/C++, Java®, etc.

The database 110 may receive data from the data stations 102, servers 106, and/or clients 108 either directly or through the communications medium 104. The data stored in the database 110 may take various forms, including, but not limited to, sales data, inventory data, accounts receivable data, accounts payable data, or any other type of measured values or data, or any combination thereof. In addition, database 110 may also store data required to generate a forecasting model, model parameters for the forecasting model, and/or predictions of future values made using the forecasting model.

Servers 106 may include one or more servers (e.g., Server 1, Server 2, . . . Server M) configured to interact with the communications medium 104 and the database 110. Each server 106 may include a processor 112, a memory 114 for storing data, and/or other storage devices (not shown), such as hard drives, NOR or NAND flash memory devices, or Read Only Memory (ROM) devices, etc. In certain embodiments, memory 114 of servers 106 may comprise a non-transitory computer-readable medium. In addition, consistent with some embodiments, servers 106 may be implemented as a server, a server system comprising a plurality of servers, or a server farm comprising a load-balancing system and a plurality of servers.

Clients 108 may include one or more clients (e.g., Client 1, Client 2, . . . Client K) configured to interact with the communications medium 104 and the database 110. Each client 108 may also include a processor 112, a memory 114 for storing data, and/or other storage devices (not shown), such as hard drives, NOR or NAND flash memory devices, or Read Only Memory (ROM) devices, etc. In certain embodiments, memory 114 of clients 108 may comprise a non-transitory computer-readable medium.

Although the above description describes data stations, clients, and servers separately, clients may perform the role of servers and vice versa. Similarly, clients may perform the role of data stations and vice versa, and servers may perform the role of data stations and vice versa. Furthermore, the embodiments of this disclosure may also be implemented on the same device serving as a data station, a client, and a server.

FIG. 2 shows a flowchart of an exemplary method 200, consistent with an embodiment of the present disclosure. As further described below, the exemplary method of FIG. 2 may be implemented for generating a forecasting model. By way of example, method 200 may be fully implemented on any one of data stations 102, servers 106, and/or clients 108. Method 200 may also be implemented in a computer network system consisting of some or all of data stations 102, servers 106, clients 108, and/or a database 110.

As shown in FIG. 2, method 200 may include a step 202 for accessing measured values at various time points t_(i). Further, in certain embodiments, step 202 may include performing a logarithmic transformation on the measured values. For example, a measured value n(t_(i)) at time point t_(i) may be converted into a corresponding transformed value Y_(i) as: Y _(i)=log(n(t _(i))+1)  (1) Transforming the measured values in this manner may improve the ability of process 200 to handle spikes in the data. Moreover, the exemplary logarithmic transformation ensures that all forecasted values are non negative. Although Equation (1) discloses a logarithmic transformation, those skilled in the art would understand that various other types of transformations, for example, Box Cox transformations, etc. may be used instead. In certain embodiments, further processing may be performed on data comprising the transformed values instead of on the accessed measured values. For example, in certain embodiments, in step 202, the transformed values may be stored in an input buffer containing n values representing measured values only for a predetermined period of time. In certain exemplary embodiments, the value of n may be 70 or 100. Further, in certain exemplary embodiments, the n values may be the most recently obtained measured values.

As discussed above, the measured values may include sales data, inventory data, accounts receivable data, accounts payable data, or any other kind of measured data. In certain embodiments, the measured values may include non daily data or non equidistant data. Further, in certain embodiments, the measured values may be obtained every hour, every day, every week, every month, or at random times. In yet other embodiments, the measured data may include multiple periodicities or seasonality variations. A person of ordinary skill in the art would understand that the seasonality is separate from the frequency at which measured values are obtained. Thus, for example, the measured values representing daily data may contain a weekly, monthly, annual, or other types of seasonality. Accessing the measured values may involve one of data stations 102, servers 106, and/or clients 108 receiving the data through the communications medium 104. Alternatively, accessing the data may involve reading the data from memory 114 or another type of storage device of one of data stations 102, servers 106, and/or clients 108.

Method 200 may also include a step 204 for identifying the components of the forecasting model. In certain embodiments, the components of the forecasting model may include a seasonal function representing seasonal variations in the data and a trend function representing a trend in the data. In other embodiments, the forecasting model may have more than one seasonal function and/or more than one trend function to accurately model the measured values having a plurality of periodicities. Exemplary functions representing the seasonal and trend components of the forecasting model, consistent with an embodiment of the present disclosure, are further described below. As shown in FIG. 2, method 200 may also include a step 206 for estimating model parameters. In certain embodiments, estimation of model parameters may involve obtaining an optimal solution by minimizing a cost function. Exemplary embodiments for model parameter estimation are further described below.

Method 200 may also include a step 208 for detecting outlier data points in the set of measured values. Exemplary embodiments and related techniques for detecting outliers are described later in this disclosure. Method 200 may further include a step 210 for deciding whether any outlier data points are present in the measured values. If it is determined at step 210 that outlier data points are present, method 200 may proceed to step 218 to identify and remove one or more outliers from the measured values. In an exemplary embodiment, step 218 identifies and removes one or more outlier data points from the measured values. As further described below, in an exemplary embodiment, outliers may be detected by estimating the deviation of the data points from the values generated by the forecasting model. For example, data having the largest deviation from the model predictions may be identified as outliers, one or more of which may be removed from the data to generate a more accurate forecasting model. Method 200 may then return to step 206 for estimating the model parameters using a new set of data with one or more outliers removed.

If, however, it is determined in step 210 that no outlier data points are present, method 200 may proceed to a step 212 for saving the model parameters, including parameters representing seasonality, and the coefficients required to compute the short-term, intermediate-term, and long-term trend components. In certain exemplary embodiments, only a limited number of parameters, for example, seasonality parameters, and coefficients and constants required to compute the short-term, intermediate-term, and long-term trend components, may be saved in step 212 thereby reducing the storage requirements associated with the forecasting method 200. Saving the model parameters may involve saving them to the memory 114 and/or another type of storage device of one of data stations 102, servers 106, or clients 108. Alternatively, or additionally, saving the model parameters may involve saving the parameters to the database 110. Method 200 may further include a step 214 for forecasting a future value using the estimated model parameters for any desired time horizon.

As further illustrated in FIG. 2, method 200 may also include a step 216 for determining whether new measurement values are available. If it is determined at step 216 that new measurements are available, method 200 may return to step 202. If, however, it is determined at step 216 that no new measurements are available, method 200 may terminate.

As discussed above, in certain embodiments, the components of the forecasting model may include a seasonal function representing seasonal variations in the data and a trend function representing a trend in the data. By way of example, Equation (2) shows an exemplary forecasting model f(t) that may be generated consistent with the present disclosure: ƒ(t)=ƒ_(seas)(t)+ƒ_(trend)(t)  (2) where ƒ_(seas)(t) represents the seasonal function and ƒ_(trend)(t) represents the trend function.

In certain embodiments, the seasonal variation in the measured values may have an arbitrary periodicity or may have multiple periodicities representing variations over 24 hours, variations over 1 week, variations over 1 month, etc. In embodiments where the seasonal variation includes multiple periodicities, Equation (2) may include additional terms to represent each of those multiple periodicities.

In certain embodiments, the seasonal and trend functions of the forecasting model may be estimated, for example, by minimizing a cost function J(f) as:

$\begin{matrix} {{{J(f)} = {{\sum\limits_{i = 1}^{n}\;{\xi^{n - i}\left( {y_{i} - {f_{seas}\left( t_{i} \right)} - {f_{trend}\left( t_{i} \right)}} \right)}^{2}} + {\lambda_{1}{\int_{0}^{T}{\left( {f_{seas}^{''}(\tau)} \right)^{2}\ {\mathbb{d}\tau}}}} + {\lambda_{2}{\int_{t_{low}}^{t_{high}}{\left( {f_{trend}^{''}(\tau)} \right)^{2}\ {\mathbb{d}\tau}}}}}},} & (3) \end{matrix}$ where ξ is a weighting factor, y_(i) represents a transformed measurement value estimated using Equation (1) at time t_(i), T represents the periodicity of the seasonal function, t_(low) represents an arbitrary time point occurring before the time point corresponding to the first value used in the forecasting model computations, t_(high) represents an arbitrary time point occurring after the time point corresponding to the n^(th) value used in the forecasting model computations, and τ represents time. In Equation (3), the first term measures the closeness of the model to the data, while the second and third terms penalize the curvature in the seasonal and trend components of the forecasting model. Penalizing the curvature of the seasonal and trend components differently allows for robust processing of outlier data points. Thus, for example, selecting a relatively large value of λ₂ may ensure that isolated outliers do not severely affect the trend estimate. Simultaneously selecting a relatively small value of λ₁, for example, may allow for capturing a significant amount of the seasonal swings in the underlying data. Moreover, setting the value ξ in Equation (3) lower than 1 may give more weight to the more recent measurements, making the model more accurate when the seasonality pattern changes over time. In certain exemplary embodiments, ξ, λ₁, and λ₂ may have values of 0.95, 0.5, and 0.005, respectively.

In certain embodiments, the seasonal function of the forecasting model may be represented using a truncated Fourier series. Thus, for example, Equation (4) shows an exemplary seasonal function consisting of a truncated Fourier series of arbitrary order m₁ and without a constant term:

$\begin{matrix} {{f_{seas}(t)} = {\sum\limits_{i = 1}^{m_{1}}\;{\left( {{\theta_{1,i}{\sin\left( {\frac{2\pi\; i}{T}t} \right)}} + {\theta_{1,{m_{1} + i}}{\cos\left( {\frac{2\pi\; i}{T}t} \right)}}} \right).}}} & (4) \end{matrix}$ The 2m₁ terms of the Fourier series in Equation (4) can be represented in matrix form as:

$\begin{matrix} {{{f_{seas}(t)} = {{N_{1}(t)}\theta_{1}}},} & (5) \\ {{N_{1}(t)} = \begin{bmatrix} {{\sin\left( {\frac{2\pi}{T}t} \right)},} & {{\sin\left( {\frac{2{\pi 2}}{T}t} \right)},} & \ldots & {{\sin\left( {\frac{2\pi\; m_{1}}{T}t} \right)},} \\ {{\cos\left( {\frac{2\pi}{T}t} \right)},} & {{\cos\left( {\frac{2{\pi 2}}{T}t} \right)},} & \ldots & {\cos\left( {\frac{2\pi\; m_{1}}{T}t} \right)} \end{bmatrix}} & (6) \\ {{\theta_{1} = {\begin{bmatrix} \theta_{1,1} \\ \theta_{1,2} \\ \vdots \\ \theta_{1,{2\; m_{1}}} \end{bmatrix}.}}\;} & (7) \end{matrix}$

The dimension of matrix θ₁ is always 2m₁×1. However, allowing t to be a sequence of n time points at which measured values may be obtained, N₁(t) can be defined to be a n×2m₁ matrix where row i corresponds to time point t_(i) as follows:

$\begin{matrix} {{N_{1}(t)} = {\begin{bmatrix} {{\sin\left( {\frac{2\pi}{T}t_{1}} \right)},} & {{\sin\left( {\frac{2{\pi 2}}{T}t_{1}} \right)},} & \ldots & {\cos\left( {\frac{2\pi\; m_{1}}{T}t_{1}} \right)} \\ {{\sin\left( {\frac{2\pi}{T}t_{2}} \right)},} & {{\sin\left( {\frac{2{\pi 2}}{T}t_{2}} \right)},} & \ldots & {\cos\left( {\frac{2\pi\; m_{1}}{T}t_{2}} \right)} \\ \vdots & \; & \; & \vdots \\ {{\sin\left( {\frac{2\pi}{T}t_{n}} \right)},} & {{\sin\left( {\frac{2{\pi 2}}{T}t_{n}} \right)},} & \ldots & {\cos\left( {\frac{2\pi\; m_{1}}{T}t_{n}} \right)} \end{bmatrix}.}} & (8) \end{matrix}$

In certain embodiments, the trend function of the forecasting model may be represented using a cubic spline function. Thus, for example, Equation (9) shows an exemplary trend function consisting of:

$\begin{matrix} {{{f_{trend}(t)} = {\sum\limits_{i = 1}^{n + 4}\;{\theta_{2,i}{B_{i,4}(t)}}}},} & (9) \end{matrix}$ where the B_(i,4)(t)s are cubic B-spline basis functions defined by a knot sequence τ₁, τ₂, . . . τ_(n+8) defined by: τ₁≦τ₂≦ . . . ≦τ_(m) ≦t _(low)  (10) τ_(i+m) =t _(i) , i=1, . . . ,n  (11) t _(high)≦τ_(n+m+1)≦τ_(n+m+2)≦ . . . ≦τ_(n+2m).  (12) where m represents a value which is one more than the order of the spline functions. Thus, for example, if cubic spline functions are used to represent the trend function, m has a value of 4. Although the above description has identified cubic spline functions, those skilled in the art would readily understand that other lower or higher order spline functions may be used to represent the trend function.

FIG. 3 shows an exemplary set of 12 cubic B-spline basis functions associated with a knot sequence generated by selecting variable distance knots in the interval 0 and 15. To make the computation less involved, B-spline basis functions generated by equidistant knots may be used. FIG. 4 shows an exemplary set of 12 cubic B-spline basis functions associated with an equidistant knot sequence in the interval 0 and 15. The sum of n+4 terms describing ƒ_(trend)(t) with equidistant knots can be represented in matrix form as:

$\begin{matrix} {{{f_{trend}(t)} = {{N_{2}(t)}\theta_{2}}},{where}} & (13) \\ {{{N_{2}(t)} = \begin{bmatrix} {{B_{1,4}(t)},} & {{B_{2,4}(t)},} & \ldots & {B_{{n + 4},4}(t)} \end{bmatrix}}{and}} & (14) \\ {\theta_{2} = {\begin{bmatrix} \theta_{2,1} \\ \theta_{2,2} \\ \vdots \\ \theta_{2,{n + 4}} \end{bmatrix}.}} & (15) \end{matrix}$

The dimension of matrix θ₂ is always (n+4)×1. However, allowing t to be a sequence of n time points at which measured values may be obtained, N₂(t) can be defined to be an n×(n+4) matrix where row i corresponds to time point t_(i) as follows:

$\begin{matrix} {{N_{2}(t)} = \begin{bmatrix} {{B_{1,4}\left( t_{1} \right)},} & {{B_{2,4}\left( t_{1} \right)},} & \ldots & {B_{{n + 4},4}\left( t_{1} \right)} \\ {{B_{1,4}\left( t_{2} \right)},} & {{B_{2,4}\left( t_{2} \right)},} & \ldots & {B_{{n + 4},4}\left( t_{2} \right)} \\ \vdots & \; & \; & \vdots \\ {{B_{1,4}\left( t_{n} \right)},} & {{B_{2,4}\left( t_{n} \right)},} & \ldots & {B_{{n + 4},4}\left( t_{n} \right)} \end{bmatrix}} & (16) \end{matrix}$

For a uniform knot sequence, the B-spline basis functions satisfy: B _(i,4)(t)=B _(0,4)(t−τ _(i)),  (17) where B_(0,4)(t) is defined by:

$\begin{matrix} {{B_{0,4}(t)}:={\frac{1}{6}\left\{ \begin{matrix} {t^{3},} & {{{if}\mspace{14mu} 0} \leq t < 1} \\ \begin{matrix} {{{- 3}\left( {t - 3} \right)^{3}} - {15\left( {t - 3} \right)^{2}} -} \\ {{{21\left( {t - 3} \right)} - 5},} \end{matrix} & {{{if}\mspace{14mu} 1} \leq t < 2} \\ \begin{matrix} {{3\left( {t - 3} \right)^{3}} + {3\left( {t - 3} \right)^{2}} -} \\ {{{3\left( {t - 3} \right)} + 1},} \end{matrix} & {{{if}\mspace{14mu} 2} \leq t < 3} \\ {\left( {4 - t} \right)^{3},} & {{{if}\mspace{14mu} 3} \leq t < 4} \\ {0,} & {{otherwise}.} \end{matrix} \right.}} & (18) \end{matrix}$ Utilizing the relationship between B_(i,4) and B_(0,4), N₂(t) may be written as:

$\begin{matrix} {{N_{2}(t)} = \begin{bmatrix} {{B_{0,4}\left( {t_{1} - \tau_{1}} \right)},} & {{B_{0,4}\left( {t_{1} - \tau_{2}} \right)},} & \ldots & {B_{0,4}\left( {t_{1} - \tau_{n - 4}} \right)} \\ {{B_{0,4}\left( {t_{2} - \tau_{1}} \right)},} & {{B_{0,4}\left( {t_{2} - \tau_{2}} \right)},} & \ldots & {B_{0,4}\left( {t_{2} - \tau_{n - 4}} \right)} \\ \vdots & \; & \; & \vdots \\ {{B_{0,4}\left( {t_{n} - \tau_{1}} \right)},} & {{B_{0,4}\left( {t_{n} - \tau_{2}} \right)},} & \ldots & {B_{0,4}\left( {t_{n} - \tau_{n - 4}} \right)} \end{bmatrix}} & (19) \end{matrix}$ Moreover, if measurement values are available at times t₁, . . . , t_(n), N₂(t) may be written as:

$\begin{matrix} {{N_{2}(t)} = \begin{bmatrix} {{B_{0,4}(4)},} & {{B_{0,4}(3)},} & \ldots & {B_{0,4}\left( {1 - n} \right)} \\ {{B_{0,4}(5)},} & {{B_{0,4}(4)},} & \ldots & {B_{0,4}\left( {2 - n} \right)} \\ \vdots & \; & \; & \vdots \\ {{B_{0,4}\left( {n + 3} \right)},} & {{B_{0,4}\left( {n + 2} \right)},} & \ldots & {B_{0,4}(0)} \end{bmatrix}} & (20) \end{matrix}$ or equivalently

$\begin{matrix} {{N_{2}(t)} = {\begin{bmatrix} 0 & \frac{1}{6} & \frac{4}{6} & \frac{1}{6} & 0 & \ldots & 0 & 0 & 0 & 0 \\ 0 & 0 & \frac{1}{6} & \frac{4}{6} & \frac{1}{6} & \; & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & \frac{1}{6} & \frac{4}{6} & \; & 0 & 0 & 0 & 0 \\ \vdots & \; & \; & \; & \; & \; & \; & \; & \; & \vdots \\ 0 & 0 & 0 & 0 & 0 & \; & \frac{4}{6} & \frac{1}{6} & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \ldots & \frac{1}{6} & \frac{4}{6} & \frac{1}{6} & 0 \end{bmatrix}.}} & (21) \end{matrix}$

Using Equations (1)-(21), the seasonality parameters, {tilde over (s)}₃, and the trend components of the measured values, {tilde over (s)}₄, of the forecasting model can be obtained using the following equations: {tilde over (s)} ₃ =[Ñ ₁0 . . . 0]{circumflex over (θ)}  (22) {tilde over (s)} ₄=[0 . . . 0N ₂]{circumflex over (θ)}  (23) {circumflex over (θ)}=(N(t)^(T) WN(t)+{tilde over (Ω)}(λ₁,λ₂))⁻¹ N(t)^(T) WY,  (24) where the ˜ indicates that the values in vectors {tilde over (s)}₃ and {tilde over (s)}₄ computed using Equations (22) and (23) are intermediate values and do not represent final values of the seasonality and trend parameters of the forecasting model. Moreover, in Equation (22), {tilde over (s)}₃ represents a vector containing the seasonality parameters. For example, if the data show a weekly seasonality, {tilde over (s)}₃ may contain 7 values each representing the seasonality contribution corresponding to a day of the week. Similarly, {tilde over (s)}₄ in Equation (23) represents a vector containing the estimated value of the trend component corresponding to each of the n measured values used for generating the model parameters. Further, Ñ₁, in Equation (22) is computed from the same sequence of time stamps corresponding to the time points at which data is measured. Thus, for example, if the data has a periodicity of T, Ñ₁ is computed from time points 1 through T. An advantage of this approach is that the k^(th) value of {tilde over (s)}₃ and s₃ then always correspond to the k^(th) time point within one period of the seasonality. A further advantage is that Ñ₁ can be precomputed because it is primarily a mapping from the Fourier series coefficients to the sequence of time stamps that make up one period of the seasonality. The various terms comprised in Equation (24) are defined below:

$\begin{matrix} {\mspace{79mu}{{\overset{\sim}{\Omega}\left( {\lambda_{1},\lambda_{2}} \right)} = \begin{bmatrix} {\lambda_{1}\Omega_{1}} & 0 \\ 0 & {\lambda_{2}\Omega_{2}} \end{bmatrix}}} & (25) \\ {\mspace{79mu}{\Omega_{1} = {\left( \frac{2}{T} \right)^{3}{\pi^{4}\begin{bmatrix} 1^{4} & 0 & \ldots & 0 & 0 & \ldots & 0 \\ 0 & 2^{4} & \; & 0 & 0 & \; & 0 \\ \vdots & \; & \ddots & \; & \; & \; & \vdots \\ 0 & 0 & \; & m_{1}^{4} & 0 & \; & 0 \\ 0 & 0 & \; & 0 & 1^{4} & \; & 0 \\ \vdots & \; & \; & \; & \; & \ddots & 0 \\ 0 & 0 & \ldots & 0 & 0 & \; & m_{1}^{4} \end{bmatrix}}}}} & (26) \\ {\Omega_{2} = \begin{bmatrix} \frac{1}{3} & {- \frac{1}{2}} & 0 & \frac{1}{6} & 0 & \ldots & 0 & 0 & 0 & 0 \\ {- \frac{1}{2}} & \frac{4}{3} & {- 1} & 0 & \frac{1}{6} & \ddots & 0 & 0 & 0 & 0 \\ 0 & {- 1} & \frac{7}{3} & {- \frac{3}{2}} & 0 & \ddots & 0 & 0 & 0 & 0 \\ \frac{1}{6} & 0 & {- \frac{3}{2}} & \frac{8}{3} & {- \frac{3}{2}} & \ddots & 0 & 0 & 0 & 0 \\ \vdots & \; & \; & \; & \; & \; & \; & \; & \; & \vdots \\ 0 & 0 & 0 & 0 & 0 & \ddots & {- \frac{3}{2}} & 0 & \frac{1}{6} & 0 \\ 0 & 0 & 0 & 0 & 0 & \ddots & \frac{8}{3} & {- \frac{3}{2}} & 0 & \frac{1}{6} \\ 0 & 0 & 0 & 0 & 0 & \ddots & {- \frac{3}{2}} & \frac{7}{3} & {- 1} & 0 \\ 0 & 0 & 0 & 0 & 0 & \ddots & 0 & {- 1} & \frac{4}{3} & {- \frac{1}{2}} \\ 0 & 0 & 0 & 0 & 0 & \; & \frac{1}{6} & 0 & {- \frac{1}{2}} & \frac{1}{3} \end{bmatrix}} & (27) \\ {\mspace{79mu}{Y = \begin{bmatrix} {y\left( t_{1} \right)} \\ {y\left( t_{2} \right)} \\ \vdots \\ {y\left( t_{n} \right)} \end{bmatrix}}} & (28) \\ {\mspace{79mu}{\theta = \begin{bmatrix} \theta_{1} \\ \theta_{2} \end{bmatrix}}} & (29) \\ {\mspace{79mu}{{N(t)} = \begin{bmatrix} {N_{1}(t)} & N_{2} \end{bmatrix}}} & (30) \\ {\mspace{79mu}{W = \begin{bmatrix} \xi^{n - 1} & \; & \; & 0 \\ \; & \ddots & \; & \vdots \\ \; & \; & \xi & 0 \\ 0 & \ldots & 0 & 1 \end{bmatrix}}} & (31) \end{matrix}$

To ensure that the computational cost of processing measurement data does not exponentially increase over time, in certain embodiments, computations may be performed only on the n most recent measurement values. As long as the number of values n is sufficiently large, the impact on the estimation of the forecasting model parameters may be expected to be insignificant for two reasons. First, the forgetting factor ξ may be set to values less than 1 to reduce the influence of old values on the forecasting model. And, second, the spline functions used in the trend component by their very nature represent localized variations.

FIG. 5 shows a flowchart of an exemplary method 500, consistent with an embodiment of the present disclosure. As further described below, the exemplary method 500 of FIG. 5 may be implemented for detecting and removing outliers from the measured values to generate a more accurate forecasting model. By way of example, method 500 may be implemented on mainframe computers or back-end servers, for example, servers 106. Those skilled in the art will, however, understand from the present disclosure that method 500 may also be implemented on any one of data stations 102 and/or clients 108. Further, method 500 may be implemented in an exemplary computer network system wherein any one of data stations 102, servers 106, and/or clients 108 access data from a database 110, and store the new data set after removing outliers in database 110.

As shown in FIG. 5, method 500 may include a step 502 for initializing the outlier count to zero. Method 500 may also include a step 504 for calculating the residuals, r(t_(i)), at each time point t_(i) corresponding to the measured values n(t_(i)) used for computing the model parameters of the forecasting model. In certain embodiments, the residual corresponding to time point t_(i) may be estimated as: r(t _(i))=log(n(t _(i))+1)−ƒ_(seas)(t _(i))−ƒ_(trend)(t _(i)).  (32) Those skilled in the art would understand that Equation (32) applies to the case where a logarithmic transformation has been applied to the measured values and that the equation may have to be appropriately modified if other types of transformations are used to transform the measured values. In other embodiments, calculating the residuals may also include calculating a standard deviation σ of the residuals.

Method 500 may further include a step 506 for identifying measurement values having residuals that exceed a multiple, c×σ, of the standard deviation σ, where c is a predetermined scaling factor. In certain exemplary embodiments, c may have a value of 3. To prevent too many measured values from being removed as outliers, method 500 may include a check to stop detection and removal of outliers if the outlier count exceeds a threshold. Thus, for example, method 500 may include a step 508 for determining whether the outlier count exceeds a threshold. If it is determined at step 508 that the outlier count exceeds a threshold, process 500 for detecting and removing outliers may terminate. If, however, it is determined at step 508 that the outlier count does not exceed the threshold, method 500 may proceed to step 510 for removing the measurement value corresponding to the residual value exceeding c×σ. In certain embodiments, the threshold may be selected based on a predetermined percentage of the total number of measured values used for the calculations. Thus, for example, in a data set consisting of 70 values, if the threshold is chosen as 10%, a maximum of 7 outliers may be removed from the data set using method 500. Method 500 may then proceed to step 512 for incrementing the outlier count by 1. In addition, method 500 may proceed to step 514 for recalculating the model parameters as described above after removing the outlier from the set of measured values. Method 500 may then return to step 504.

FIGS. 6A-6E illustrate, by way of example, how an exemplary forecasting model may change as a result of sequentially removing outliers. FIGS. 6A-6E include outlier data points 602, measured values 606, and the forecasting model 604. As shown in FIG. 6A, the forecasting model 604 is very volatile because the data set used to estimate the forecasting model parameters includes all the outlier data points 602. FIGS. 6B, 6C, 6D, and 6E illustrate the effect of removing 1, 2, 3, or 6 outliers on the forecasting model 604. A comparison of FIGS. 6A-6E shows that as more outlier data points 602 are removed from the measured values 606, the forecasting model 604 better approximates the seasonal and trend variations in the measured values.

FIGS. 7A-7E, by way of example, illustrate the impact of removing the outlier data points 602 on the residuals 704. In FIGS. 7A-7E, the dotted lines 702 represent a band spanning ±c×σ of the residuals 704. FIG. 7A shows that the band 702 is very wide when none of the outlier data points 602 have been removed from the transformed values 606. A comparison of FIGS. 7A-7E shows that as more and more outlier data points 602 are removed, the residual band 702 shrinks. Thus, for example, FIG. 7E shows the narrowest residual band 702 after 6 outlier data points 602 have been removed from the data set used to estimate the forecasting model parameters. Thus, by removing the outlier data points 602, the forecasting model 604 can be tuned to more accurately represent the transformed values 606 on which it is based. Note that the outlier data points 602 are not permanently removed from the set of transformed values 606. When new measured values become available, for example, all the removed outlier data points are retrieved and included in the computation of the model parameters.

In certain embodiments, a post filter process may be implemented before storing the seasonality and trend parameters of the forecasting model. Thus, for example, a post filter process consistent with the present disclosure may be implemented before step 212 of process 200 shown in FIG. 2. The post filter process, when applied to the seasonal variation predicted by the model, ensures that the seasonal component of the forecast is not subject to sudden dramatic changes as a result of sudden changes in the data used to generate the model.

FIG. 8 shows a flowchart of an exemplary method 800, consistent with an embodiment of the present disclosure. As further described below, the exemplary method 800 of FIG. 8 may be implemented for post filtering the values computed at each time point t_(i) using the forecasting model. By way of example, method 800 may be implemented on mainframe computers or back-end servers, for example, servers 106. Those skilled in the art will, however, understand from the present disclosure that method 800 may also be implemented on any one of data stations 102 and/or clients 108. Further, method 800 may be implemented in an exemplary computer network system wherein any one of data stations 102, servers 106, and/or clients 108 access data from a database 110, and store the computed data after post filtering in database 110.

As shown in FIG. 8, method 800 may include a step 802 for accessing the seasonality vector, {tilde over (s)}₃, computed, for example, using Equation (22) from database 110. In certain embodiments, method 800 may be applied to the seasonality parameters computed in step 206 of method 200 directly without first saving them in database 110. The first time method 800 is executed, S_(max-Old), a value representing a maximum permissible value for any of the components of vector {tilde over (s)}₃, may be obtained by computing it as: S _(max-Old)=max({tilde over (s)} _(3,i))+c ₁  (33) where c₁ is an offset factor. In certain embodiments, c₁ may have a value of 1.

When method 800 is executed subsequently, it may include a step 804 for accessing the old maximum permissible value, S_(max-Old), based on the most recently calculated seasonality parameters, stored in the database 110. Accessing the model parameters and/or the old maximum permissible value may involve one or more of data stations 102, servers 106, and clients 108 receiving the model parameters and/or the old maximum permissible value through the communications medium 104. Alternatively, or additionally, accessing the model parameters and/or the old maximum permissible value may involve reading these data from memory 114 or another type of storage device of one of data stations 102, servers 106, and/or clients 108.

Method 800 may further include a step 806 for computing a new or updated maximum permissible value, S_(max), of the seasonal parameters. In certain embodiments, the post filter process may use a weighted estimate of S_(max). Thus, for example, the post filter process may include a seasonality saturation generator that prevents the value of S_(max) from changing suddenly. For example, S_(max) may be computed as: S _(max)=α₁ S _(max-Old)+(1−α₁)[min(max_(i)({tilde over (s)} _(3,i)),S _(max-Old))+c ₂],  (34) where {tilde over (s)}_(3,i) represents the value of each seasonal parameter, S_(max-Old) represents the old maximum permissible value of the seasonal parameters, α₁ represents a weighting factor and c₂ represents an offset factor. In certain exemplary embodiments, α₁ may have a value of 0.9 and c₂ may have a value of 0.1.

Method 800 may also include a step 806 for adjusting the seasonal parameters based on the computed value of S_(max). In certain embodiments, step 806 may be referred to as a seasonality filter that ensures that the seasonal parameters are not excessively influenced by sudden seasonality changes in the measured values. In an exemplary embodiment, the values of the seasonality parameters, {tilde over (s)}_(3,i), may be adjusted as follows: s′ _(3,i)=min({tilde over (s)} _(3,i) ,S _(max))  (35) s _(3,i)=α₂ s _(3,i) ^(old)+(1−α₂)s′ _(3,i),  (36) where the old values of s_(3,i) ^(old) represent the historical values of these parameters. The first time method 800 is executed, the old values may be initialized to 0. Subsequently, Equation (36) may be used to estimate the final adjusted values of the seasonality parameters in vector s₃. In certain exemplary embodiments, α₂ may have a value of 0.2. Method 800 may also include a step 810 of storing the newly computed S_(max) value from step 806 as the old maximum permissible value, S_(max-Old), of the seasonal parameters. While method 800 has been described in terms of the seasonal function of the forecasting model, those skilled in the art will understand from the present disclosure that a similar post filter process may be applied to the trend component of the model.

FIG. 9 shows a flowchart of an exemplary method 900, consistent with an embodiment of the present disclosure. As further described below, the exemplary method of FIG. 9 may be implemented for forecasting future values for any desired time horizon. By way of example, method 900 may be implemented on front end computer systems, for example, clients 108 that may access the model parameters from database 110 to generate a forecast. Those skilled in the art will, however, understand from the present disclosure that method 900 may also be implemented on any one of data stations 102 and/or servers 106. Further, those skilled in the art will understand from the present disclosure that method 900 may be implemented in an exemplary computer network system wherein any one of data stations 102, servers 106, and/or clients 108 may access data and model parameters from a database 110, generate forecasted values, and store the forecasted values in database 110.

Method 900 may include a step 902 for accessing the seasonality parameters s₃ and the trend components s₄. Accessing these values may involve one of data stations 102, servers 106, and/or clients 108 receiving these values through the communications medium 104. Alternatively, accessing these values may involve reading the values from memory 114 or another type of storage device of one of data stations 102, servers, 106, or clients 108. In other embodiments, the seasonality parameters s_(3,i) and the trend components in vector s₄ may be obtained directly, without first storing them in database 110, as a result of methods 200 and/or 800.

Method 900 may include a step 904 for estimating the trend component of for the time point corresponding to the n^(th) data point used to generate the forecasting model parameters. In certain embodiments, where very few measured values are available, the trend component of the forecasted value at for the time point corresponding to the n^(th) data point may be obtained as a median of all the values in the vector s₄. In certain exemplary embodiments, such a median calculation may be used if the number of measured values n is less than 10. In other exemplary embodiments, where the number of measured values is sufficiently large, the trend component of the forecasted value may be obtained as a weighted average as:

$\begin{matrix} {a_{0}^{\prime} = \frac{\sum\limits_{i = 1}^{K}\;{\left( \frac{i}{K + 1} \right)^{\alpha_{point} - 1}\left( {1 - \frac{i}{K + 1}} \right)^{\beta_{point} - 1}{\hat{Y}}_{N - K + i}^{trend}}}{\sum\limits_{i = 1}^{K}\;{\left( \frac{i}{K + 1} \right)^{\alpha_{point} - 1}\left( {1 - \frac{i}{K + 1}} \right)^{\beta_{point} - 1}}}} & (37) \\ {a_{0} = {{\alpha_{0}a_{0}^{old}} + {\left( {1 - \alpha_{0}} \right)a_{0}^{\prime}}}} & (38) \end{matrix}$ where K is an integer no larger than the number of values in the vector s₄ but is typically much smaller, Ŷ_(i) represents a value in the vector s₄, α₀ ^(old) represents an old value of α₀ based on the most recently calculated values in the vector s₄, and α_(point), β_(point), and α₀ are configuration parameters. The first time method 900 is executed α₀ ^(old) is initialized as the median of all the values in the vector s₄. After calculating α₀, the value of α₀ ^(old) is updated with the newly calculated value of α₀ for use in subsequent runs of method 900. The exemplary weighting scheme in Equation (38) may ensure that the trend component, α₀, predicted for the time point corresponding to the n^(th) value is neither too influenced by the last value in the vector s₄, nor any of the other values in the vector s₄ that correspond to earlier time points. In certain embodiments, K may take a value of 10, α_(point) may take a value of 1.4, β_(point) may take a value of 1.2 and α₀ may take a value of 0.4. Further, in certain embodiments, the forecasted trend component α₀ may represent the intercept for the short-term trend function.

Method 900 may further include a step 906 for computing the slope of the short-term trend function based on a relatively small number of the most recent estimates in vector s₄. In certain embodiments, only the estimates corresponding to the most recent 30 time points may be used to compute the short-term trend. Additionally, in certain embodiments, that short-term trend may be obtained by performing a linear regression, non linear regression, or weighted regression on estimates stored in vector s₄. In certain exemplary embodiments, the slope of the short-term trend line may be computed as: {tilde over (α)}₁=({tilde over (X)} ^(T) W{tilde over (X)}) ⁻¹ {tilde over (X)} ^(T) W{tilde over (Y)}  (39) where, {tilde over (α)}₁ represents an intermediate computed value of the slope,

$\begin{matrix} {{\overset{\sim}{X} = \left\lbrack {{T_{n - S + 1} - T_{n}},{T_{n - S + 2} - T_{n}},\ldots\mspace{14mu},{T_{n} - T_{n}}} \right\rbrack^{T}},} & (40) \\ {{\overset{\sim}{Y} = \left\lbrack {{{\hat{Y}}_{n - S + 1}^{trend} - a_{0}},{{\hat{Y}}_{n - S + 2}^{trend} - a_{0}},\ldots\mspace{14mu},{{\hat{Y}}_{n}^{trend} - a_{0}}} \right\rbrack^{T}},} & (41) \\ {{w_{i} = {\left( \frac{i}{S + 1} \right)^{\alpha_{short} - 1}\left( {1 - \frac{i}{S + 1}} \right)^{\beta_{short} - 1}}},{i = 1},{\ldots\mspace{14mu} S},} & (42) \\ {{W = {{diag}\left( {w_{1},{\ldots\mspace{14mu} w_{S}}} \right)}},} & (43) \end{matrix}$ where T_(i) represents the time point, S represents the number of values being used to estimate the short-term trend (e.g. 30), and α_(short) and β_(short) represent configuration parameters. In certain exemplary embodiments, α_(short) may have a value of 1.4 and β_(short) may have a value of 1.2.

In certain embodiments, the computed value {tilde over (α)}₁ may be subjected to post filtering to ensure it does not change suddenly because of sudden large variations in the measured values. Thus, for example, if the intermediate value {tilde over (α)}₁ exceeds the maximum permissible value of the short-term trend slope, α₁ ^(max), then α′₁ may be set to the maximum permissible value α₁ ^(max). If on the other hand, for example, {tilde over (α)}₁ is less than the minimum permissible value of the short-term trend slope, α₁ ^(min), then α′₁ may be set to the minimum permissible value α₁ ^(min). If {tilde over (α)}₁ lies between the minimum and maximum permissible values α′₁ may be assigned the intermediate value {tilde over (α)}₁. The slope α_(l) for the short-term trend line may then be estimated using a weighted average as: α₁=α₁α₁ ^(old)+(1−α₁)α′₁  (44) where, α₁ ^(old) represents the historical value or the most recently computed value of the slope, and α₁ represents a weighting factor. The first time method 900 is executed, α₁ ^(old) may be initialized to 0. Once a new value of the slope α₁ has been calculated, it may be stored as α₁ ^(old) for any future calculations of the slope α₁. In certain embodiments, α₁ may have a value of 0.7.

Method 900 may further include a step 908 for computing the slope and intercept of the long-term trend function based on a large number of values or all the values in vector s₄. In certain exemplary embodiments, the number of values used for computing the long-term trend may be 70. In certain embodiments, that long-term trend may be obtained by performing a linear regression, non-linear regression, or weighted regression on estimates stored in vector s₄. In certain exemplary embodiments, the intercept, b′₀, and the slope, b′₁, of the long-term trend line may be computed as:

$\begin{matrix} {\begin{bmatrix} {\overset{\sim}{b}}_{0} \\ {\overset{\sim}{b}}_{1} \end{bmatrix} = {\left( {{\overset{\sim}{X}}^{T}W\overset{\sim}{X}} \right)^{- 1}{\overset{\sim}{X}}^{T}W\overset{\sim}{Y}}} & (45) \end{matrix}$ where, {tilde over (b)}₀ and {tilde over (b)}₁ represent intermediate computed values of the intercept and slope respectively,

$\begin{matrix} {{\overset{\sim}{X} = \begin{bmatrix} 1 & 1 & \ldots & 1 \\ {{T_{n - L + 1} - T_{n}},} & {{T_{n - L + 2} - T_{n}},} & {\ldots,} & {T_{n} - T_{n}} \end{bmatrix}^{T}},} & (46) \\ {{\overset{\sim}{Y} = \begin{bmatrix} {{\hat{Y}}_{n - L + 1}^{trend},} & {{\hat{Y}}_{n - L + 2}^{trend},} & {\ldots,} & {\hat{Y}}_{n}^{trend} \end{bmatrix}^{T}},} & (47) \\ {{w_{i} = {\left( \frac{i}{L + 1} \right)^{\alpha_{long} - 1}\left( {1 - \frac{i}{L + 1}} \right)^{\beta_{long} - 1}}},{i = 1},{\ldots\mspace{14mu} L},} & (48) \\ {{W = {{diag}\left( {w_{1},{\ldots\mspace{14mu} w_{L}}} \right)}},} & (49) \end{matrix}$ where T_(i) represents the time point, L represents the number of values being used to estimate the long-term trend (e.g. 70), and α_(long) and β_(long) represent configuration parameters. In certain exemplary embodiments, α_(long) may have a value of 1.4 and β_(long) may have a value of 1.2.

In certain embodiments, the computed values may be subjected to post filtering to ensure that they do not change suddenly because of sudden large variations in the measured values. Thus, for example, if the intermediate value {tilde over (b)}₁ exceeds the maximum permissible value of the long-term trend slope, b₁ ^(max), then b′₁ may be set to the maximum permissible value b₁ ^(max). If on the other hand, for example, {tilde over (b)}₁ is less than the minimum permissible value of the long-term trend slope, b₁ ^(min), then b′₁ may be set to the minimum permissible value b₁ ^(min). In both these cases, the computed value of the intercept, b′₀, may be estimated as: b′ ₀=({tilde over (X)} _(:,1) ^(T) W{tilde over (X)} _(:,1))⁻¹ {tilde over (X)} _(:,1) ^(T) W({tilde over (Y)}−{tilde over (X)} _(:,2) b′ ₁)  (50) If {tilde over (b)}₁ lies between the minimum and maximum permissible values b′₁ may be assigned the intermediate value {tilde over (b)}₁ and b′₀ may be assigned the intermediate value {tilde over (b)}₀. In certain embodiments, the slope, b₀, and intercept, b₁, of the long-term trend line may then be computed as:

$\begin{matrix} {\begin{bmatrix} b_{0} \\ b_{1} \end{bmatrix} = {{\alpha_{2}\begin{bmatrix} b_{0}^{old} \\ b_{1}^{old} \end{bmatrix}} + {\left( {1 - \alpha_{2}} \right)\begin{bmatrix} b_{0}^{\prime} \\ b_{1}^{\prime} \end{bmatrix}}}} & (51) \end{matrix}$ where, b₀ ^(old) and b₁ ^(old) represent the historical values or the most recently computed values of the intercept and slope respectively, and α₂ represents a weighting factor. Further, when method 900 is executed for the first time, b₀ ^(old) may be initialized to the median of the estimates in vector s₄ and b₁ ^(old) may be initialized to 0. Once new values of the intercept and the slope have been calculated they may be stored in the database 110 as b₀ ^(old) and b₁ ^(old) respectively for any future calculations of b₀ and b₁. In certain embodiments, α₂ may have a value of 0.7.

Method 900 may further include a step 910 for estimating a transition function between the short-term and long-term trends. The transition function allows forecasting of the trend components in intermediate time horizons that are neither too short nor too long. In certain embodiments, the transition function may be a polynomial function having a continuous slope between the short-term and long-term trend lines. Thus, for example, in certain embodiments, a polynomial function: ŷ _(trend) =c ₀ +c ₁ h+c ₂ h ² +c ₃ h ³  (52) may be used to estimate the trend component at an intermediate time horizon. In Equation (52), h represents the forecasting horizon for which a prediction is desired, and the parameters c₀, c₁, c₂, and c₃ for the polynomial function may be estimated as:

$\begin{matrix} {\begin{bmatrix} c_{0} \\ c_{1} \\ c_{2} \\ c_{3} \end{bmatrix} = {A^{- 1}{B\begin{bmatrix} a_{0} \\ a_{1} \\ b_{0} \\ b_{1} \end{bmatrix}}}} & (53) \end{matrix}$ where, α₀ and α₁ represent the intercept and slope of the short-term trend, and b₀ and b₁ represent the intercept and slope for the long-term trend. The matrices A and B in Equation (53) may be written as:

$\begin{matrix} {A = \begin{bmatrix} 1 & t_{1} & t_{1}^{2} & t_{1}^{3} \\ 0 & 1 & {2\; t_{1}} & {3\; t_{1}^{2}} \\ 1 & t_{2} & t_{2}^{2} & t_{2}^{3} \\ 0 & 1 & {2\; t_{2}} & {3\; t_{2}^{2}} \end{bmatrix}} & (54) \\ {{B = \begin{bmatrix} 1 & t_{1} & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & t_{2} \\ 0 & 0 & 0 & 1 \end{bmatrix}},} & (55) \end{matrix}$ where t₁ represents a forecasting horizon up to which the short-term trend function may be used to compute a trend component, and t₂ represents a forecasting horizon beyond which the long-term trend function may be used to compute the trend component.

In certain embodiments, the intercept estimated in step 904 and the slope of the short-term trend line estimated in step 906 may be used to forecast values for a short-term time horizon beginning from the present time to a forecasting horizon t₁. In exemplary embodiments, t₁ may correspond to the at most the next 10 time points. In other embodiments, the slope and intercept of the long-term trend line may be used to forecast values for a long-term time horizon larger than t₂. In certain exemplary embodiments, t₂ may correspond to time points beyond the next 100 time points.

Method 900 may further include a step 912 of aggregating and storing all the model parameters, including the seasonality parameters obtained after the post filtering process, the intercepts and slopes for the short-term, and long-term trend lines, and the polynomial coefficients needed to forecast values for intermediate time horizons. Thus, for example, for a data set having a weekly seasonality pattern, the parameters α₀, α₁, t₁, b₀, b₁, t₂, c₀, c₁, c₂, and c₃, and the seven seasonality parameters s_(3,1), s_(3,2), s_(3,3), s_(3,4), s_(3,5), s_(3,6), and s_(3,7), corresponding to each of the seven days of the week, may be stored in database 110.

Method 900 may further include a step 914 for forecasting future values for any desired time horizon. For example, when the measured values demonstrate a weekly seasonality, the seasonality parameter, ŷ_(seas), for any forecasting horizon h in the future can be obtained by determining the day of the week corresponding to “t_(n)+h” and selecting one of the seven seasonality parameters from the stored set of seasonality parameters s_(3,1), s_(3,2), s_(3,3), s_(3,4), s_(3,5), s_(3,6), and s_(3,7). Further, the short-term trend coefficients can be used to estimate the trend component, ŷ_(trend), for forecasting horizon h if h<t₁ as: ŷ _(trend)=α₀+α₁ h.  (56) If, on the other hand, the forecasting horizon h>t₂, then the long-term trend coefficients can be used to estimate the trend component, ŷ_(trend), as: ŷ _(trend) =b ₀ +b ₁ h.  (57) Additionally, if the forecasting horizon h corresponds to an intermediate time horizon such that t₁≦h≦t₂, then the intermediate-term polynomial function can be used to estimate the trend component ŷ_(trend), as: ŷ _(trend) =c ₀ +c ₁ h+c ₂ h ² +c ₃ h ³.  (58) A seasonality component can also be estimated for the forecasting horizon h using the seasonality parameters. For example, if the measured values show a weekly seasonality, then a seasonality component, ŷ_(seas), may be estimated by first determining the day of the week to which forecasting horizon h corresponds and assigning ŷ_(seas) the specific value of s₃ corresponding to that day of the week. In certain embodiments, the seasonality component, ŷ_(seas), and the trend component, ŷ_(trend), may then be combined to estimate the future value at forecasting horizon h as: {circumflex over (n)}=exp(ŷ _(seas) +ŷ _(trend)).  (59) Those skilled in the art would understand that the exponential function in Equation (59) may be used only when a logarithmic transformation is applied to the measured values and that Equation (59) would have to be appropriately modified if other non logarithmic transformations are used.

In an exemplary embodiment, the measured values for which forecasting is desired may consist of the volume of impressions of advertisements displayed on a web page. Thus, each time a particular advertisement is displayed to a user when the user accesses a web page, it may be counted as one impression. It may be desirable to generate a forecasting model to represent the impression volume data to be able to forecast the anticipated volume of impressions at a future time. Such forecasts may be useful, for example, for determining the pricing for a particular advertisement, its placement on a web page, or even to determine the hardware and/or software capacity required to deliver the anticipated volume of impressions to users at the future date. The measured values representing the volume of impressions may be collected on an hourly, daily, weekly, or monthly basis. Moreover, the measured values may demonstrate a weekly, monthly, or some other pattern of seasonality. Some or all of the methods 200, 500, 800, and 900 may be used to generate a forecasting model for the volume of impressions. The forecasting model so generated may also be used to estimate the number of impressions at a future time.

Embodiments of the present disclosure may be implemented in various environments and by various components. In certain embodiments, the exemplary methods and techniques discloser herein may be implemented on a data station, a server, a client, or in a system consisting of data stations, servers, and clients. Thus, for example, embodiments may be implemented in which a server 106 may perform, for example, steps 202 through and including 210 on the measured values stored in the database 110 by accessing the measured values from the database 110. The server 106 may also store the seasonality parameters and the coefficients for the short-term, long-term, and intermediate-term trend lines in the database 110 by performing the exemplary processes disclosed herein.

Furthermore, embodiments may be implemented in which a client 108 may have access to the database 110. In such embodiments, the client 108 may perform a method for generating a forecasting model, as well as forecasting a future value using the stored seasonality parameters and the coefficients for the short-term, long-term, and intermediate-term trend lines by performing the exemplary processes disclosed herein.

In addition, embodiments may be implemented in which a data station 102 may have access to the database 110. In such embodiments, the data station 102 may perform the entire forecasting model generation process, including forecasting a future value using the computed forecasting model parameters according to the exemplary processes disclosed herein.

Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims. 

What is claimed is:
 1. A computer-implemented method for forecasting a future value of a volume of impressions for an advertisement, the method comprising: generating a forecasting model comprising a seasonal function representing a seasonal variation and a trend function representing a trend, the seasonal function comprising seasonality coefficients and the trend function comprising trend coefficients; minimizing a cost function comprising an error between a first set of values and estimated values corresponding to the first set of values computed using the forecasting model; computing, with at least one processor, the seasonality coefficients and the trend coefficients; adjusting the seasonality coefficients based on historical values of the seasonality coefficients; adjusting the trend coefficients based on historical values of the trend coefficients; forecasting, with the at least one processor, the future value using the adjusted seasonality coefficients and the adjusted trend coefficients; and determining, based on the future value, at least one of the pricing, placement, or hardware or software capacity required to display the advertisement.
 2. The computer-implemented method of claim 1, wherein the first set of values comprises a predetermined number of most recently measured values.
 3. The computer-implemented method of claim 2, wherein the first set of values comprises values obtained by transforming the measured values using a predetermined transformation.
 4. The computer-implemented method of claim 3, wherein the predetermined transformation is a logarithmic transformation.
 5. The computer-implemented method of claim 4, wherein the seasonal function comprises a truncated Fourier series.
 6. The computer-implemented method of claim 5, wherein the trend function comprises a spline function of a predetermined order.
 7. The computer-implemented method of claim 6, wherein predetermined order of the spline function is
 3. 8. The computer-implemented method of claim 7, wherein the spline function comprises cubic B-spline basis functions defined by a knot sequence.
 9. The computer-implemented method of claim 8, wherein the cost function includes a first curvature of the seasonal function.
 10. The computer implemented method of claim 9, wherein the cost function includes a second curvature of the trend function.
 11. The computer-implemented method of claim 10, wherein the first curvature is penalized using a first smoothing parameter and the second curvature is penalized using a second smoothing parameter.
 12. The computer-implemented method of claim 11, further comprising: identifying an outlier in the first set of values; removing the identified outlier from the first set of values to generate a second set of values; and computing the seasonality coefficients and the trend coefficients based on the second set of values.
 13. The computer-implemented method of claim 12, wherein identifying an outlier further comprises: computing estimated values corresponding to the first set of values using the seasonality coefficients and the trend coefficients; computing residuals between the first set of values and the estimated values; computing a standard deviation of the residuals; and identifying, as an outlier, a value from the first set of values for which a residual exceeds a predetermined multiple of the standard deviation.
 14. The computer-implemented system of claim 13, wherein computing predicted values comprises computing seasonal parameters based on the second set of values; and computing a trend component based on trend coefficients computed based on the second set of values.
 15. The computer-implemented method of claim 14, wherein computing seasonal parameters further comprises: computing a maximum permissible seasonal parameter value from the computed seasonal parameters; accessing a historical maximum permissible seasonal parameter value; adjusting the maximum seasonal parameter value using a first weighting function based on the historical maximum permissible seasonal parameter value; and adjusting the seasonal parameters using a second weighting function based on the adjusted maximum permissible seasonal parameter value.
 16. The computer-implemented method of claim 15, wherein forecasting the future value further comprises: computing a seasonal component of the future value based on the adjusted seasonal parameters; computing a trend component of the future value; and combining the seasonal component and the trend component.
 17. The computer-implemented method of claim 16, wherein computing the trend component of the future value further comprises: computing a short-term trend function using the trend components corresponding to a third set of values selected from the first set of values; computing a long-term trend function using the trend components corresponding to a fourth set of values selected from the first set of values, wherein the fourth set of values are obtained after a predetermined amount of time; computing an intermediate trend function by fitting a function between the short-term trend function and the long-term trend function, such that the function has a continuous first derivative; and computing the trend component of the future value based on the short-term trend function, the intermediate-term trend function, and the long-term trend function.
 18. The computer-implemented method of claim 17, wherein the third set of values corresponds to the most recent 30 measured values.
 19. The computer-implemented method of claim 18, wherein the fourth set of values corresponds to the most recent 70 values in the second set of values.
 20. A computer-implemented system for forecasting a future value of a volume of impressions for an advertisement, the system comprising: a database for storing a first set of values and a second set of values; a forecasting model generator for performing a model generation method comprising: generating a forecasting model comprising a seasonal function representing a seasonal variation and a trend function representing a trend, the seasonal function comprising seasonality coefficients and the trend function comprising trend coefficients; minimizing a cost function comprising an error between the first set of values and estimated values corresponding to the first set of values computed using the forecasting model; computing the seasonality coefficients and the trend coefficients; adjusting the seasonality coefficients based on historical values of the seasonality coefficients; adjusting the trend coefficients based on historical values of the trend coefficients; and storing the adjusted seasonality coefficients and the adjusted trend coefficients in the database; and a forecaster for performing a forecasting method comprising: accessing the adjusted seasonality coefficients and the adjusted trend coefficients from the database; forecasting the future value using the adjusted seasonality coefficients and the adjusted trend coefficients; and determining, based on the future value, at least one of the pricing, placement, or hardware or software capacity required to display the advertisement.
 21. The computer-implemented system of claim 20, wherein the forecasting model generator comprises a server.
 22. The computer-implemented system of claim 21, wherein the forecaster comprises a client.
 23. The computer-implemented system of claim 22, wherein the seasonal function comprises a truncated Fourier series.
 24. The computer-implemented system of claim 23, wherein the trend function comprises a spline function having a predetermined order.
 25. The computer-implemented system of claim 24, wherein the spline function comprises cubic B-spline basis functions defined by a uniform knot sequence.
 26. The computer-implemented system of claim 25, wherein a first curvature of the seasonal function is penalized using a first smoothing parameter and a second curvature of the trend function is penalized using a second smoothing parameter.
 27. The computer-implemented system of claim 26, wherein the model generation method further comprises: identifying an outlier in the first set of values; removing the identified outlier from the first set of values to generate a second set of values; storing the second set of values in the database; and computing the seasonality coefficients and the trend coefficients based on the second set of values.
 28. The computer-implemented system of claim 27, wherein forecasting the future value further comprises: computing a seasonal component of the future value based on the seasonality coefficients; computing a trend component of the future value based on the trend coefficients; and combining the seasonal component and the trend component.
 29. A computer program product comprising executable instructions tangibly embodied in a non-transitory recordable medium, which, when executed by a processor, perform a method of forecasting a future value of a volume of impressions for an advertisement, the method comprising: generating a forecasting model comprising a seasonal function representing a seasonal variation and a trend function representing a trend; minimizing a cost function comprising an error between a first set of values and model estimations corresponding to the first set of values computed using the forecasting model; computing the seasonality coefficients and the trend coefficients; adjusting the seasonality coefficients based on historical values of the seasonality coefficients; adjusting the trend coefficients based on the historical values of the trend coefficients; forecasting the future value using the adjusted seasonality coefficients and the adjusted trend coefficients; and determining, based on the future value, at least one of pricing, placement, or hardware or software capacity required to display the advertisement. 